package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduJhjySync.EduJhjySyncKeyVO;
import com.jwsoft.manager.common.vo.eduJhjySync.EduJhjySyncQueryVO;
import com.jwsoft.manager.common.vo.eduJhjySync.EduJhjySyncVO;
import com.jwsoft.manager.common.vo.eduStudentEnroll.EduStudentEnrollQueryVO;
import com.jwsoft.manager.core.integration.EduJhjySyncIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 金华教育同步网关
 *
 * @author wangtao
 * @since 2023-03-16
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "金华教育同步", description = "金华教育同步")
public class EduJhjySyncController {

    @Autowired
    public EduJhjySyncIntegration eduJhjySyncIntegration;

    @Operation(summary = "金华教育同步分页查询",description = "金华教育同步分页查询")
    @PostMapping(value = "/eduJhjySync0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduJhjySyncVO>> getList(@RequestBody @Validated EduJhjySyncQueryVO vo) {
        return AppResponse.successData(eduJhjySyncIntegration.getList(vo));
    }

    @Operation(summary = "金华教育同步根据主键查询详情",description = "金华教育同步根据主键查询详情")
    @PostMapping(value = "/eduJhjySync0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjySyncVO> getById(@RequestBody @Validated EduJhjySyncKeyVO vo) {
        return AppResponse.successData(eduJhjySyncIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育同步新增",description = "金华教育同步新增")
    @PostMapping(value = "/eduJhjySync0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjySyncVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduJhjySyncVO vo) {
        return AppResponse.successData(eduJhjySyncIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育同步修改",description = "金华教育同步修改")
    @PostMapping(value = "/eduJhjySync0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduJhjySyncVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduJhjySyncVO vo) {
        return AppResponse.successData(eduJhjySyncIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育同步删除", description = "金华教育同步删除")
    @PostMapping(value = "/eduJhjySync0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduJhjySyncKeyVO vo) {
        eduJhjySyncIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育同步删除金华唯一录取中报名数据", description = "金华教育同步删除金华唯一录取中报名数据")
    @PostMapping(value = "/eduJhjySync0007", produces = "application/json;charset=UTF-8")
    public AppResponse saveQx(@RequestBody @Validated EduStudentEnrollQueryVO vo) {
        eduJhjySyncIntegration.saveQx(vo);
        return AppResponse.successMsg("删除报名成功！");
    }


    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育报名数据单个同步", description = "金华教育报名数据单个同步")
    @PostMapping(value = "/eduJhjySync0008", produces = "application/json;charset=UTF-8")
    public AppResponse jhJyBmSync(@RequestBody @Validated EduJhjySyncVO vo) {
        eduJhjySyncIntegration.jhJyBmSync(vo);
        return AppResponse.successMsg("金华教育报名数据同步成功");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育取消录取单个同步", description = "金华教育取消录取单个同步")
    @PostMapping(value = "/eduJhjySync0009", produces = "application/json;charset=UTF-8")
    public AppResponse jhJyQxlqSync(@RequestBody @Validated EduJhjySyncVO vo) {
        eduJhjySyncIntegration.jhJyQxlqSync(vo);
        return AppResponse.successMsg("金华教育取消录取数据同步成功");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华教育录取单个同步", description = "金华教育录取单个同步")
    @PostMapping(value = "/eduJhjySync0010", produces = "application/json;charset=UTF-8")
    public AppResponse jhJylqSync(@RequestBody @Validated EduJhjySyncVO vo) {
        eduJhjySyncIntegration.jhJylqSync(vo);
        return AppResponse.successMsg("金华教育录取数据同步成功");
    }

}
